package com.jy.adscm.operation.hscrb.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.jy.adscm.bean.system.JyUser;
import com.jy.adscm.operation.hscrb.bean.ZzInalassemblyinfo;
import com.jy.adscm.operation.hscrb.bean.ZzInalassemblyinfo;
import com.jy.adscm.operation.hscrb.mapper.mysql.ZzInalassemblyinfoMapper;
import com.jy.adscm.operation.hscrb.service.ZzInalassemblyinfoService;
import com.jy.adscm.system.mapper.mysql.JyUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zyl
 * @since 2018-12-17
 */
@Service
public class ZzInalassemblyinfoServiceImpl extends ServiceImpl<ZzInalassemblyinfoMapper, ZzInalassemblyinfo> implements ZzInalassemblyinfoService {
  @Autowired
    JyUserMapper jyUserMapper;
    @Override
    public List<ZzInalassemblyinfo> selectByTid(String tid) {
        Wrapper<ZzInalassemblyinfo> wrapper =new EntityWrapper<>();
        wrapper.eq("TID",tid);
        List<ZzInalassemblyinfo> zzInalassemblyinfos = super.selectList(wrapper);
        for (ZzInalassemblyinfo zzInalassemblyinfo : zzInalassemblyinfos) {
            if (zzInalassemblyinfo.getPerson()!=null && !"".equals(zzInalassemblyinfo.getPerson())){
                JyUser jyUser = jyUserMapper.selectById(zzInalassemblyinfo.getPerson());
                zzInalassemblyinfo.setPersonName(jyUser.getName());
            }
        }
        return zzInalassemblyinfos;
    }

}
